/**
 * 设置iframe的高度,让其自适应
 */
function TuneHeight(){   
	var frm = document.getElementById("topFrame");
	var subWeb = document.frames ? document.frames["topFrame"].document : frm.contentDocument;   
	if(frm != null && subWeb != null){ 
		frm.height = subWeb.body.scrollHeight;
	}   
}   
String.prototype.Trim = function(){
	 
	return this.replace(/(^\s*)|(\s*$)/g,""); 
} 
function getlength(strTemp){
	
  var i,unLen,bLen;
  var str;
  str=strTemp;//获得当前域的值 
  
  unLen=str.length;
  bLen=str.length;
  for(i=0;i<unLen;i++)
  {
    if(str.charCodeAt(i)>255) bLen++;
  }
  
  return bLen;
  
}
/**
 * 是不是数字
 */
function isNumber(text){
	var  newPar=/^\d+$/;
	if(!newPar.test(text)){
		return false;
	}else{
		return true;
	}
}

function isChineseWord(text){
	var newPar = /^[\x00-\xff]+$/;
	if(newPar.test(text)){
		return false;
	}else{
		return true;
	}
}
function isPunctuation(text){
	var newPar = /^[0-9a-zA-Z\u4E00-\u9FA5]+$/;
	if(!newPar.test(text)){
		return false;
	}else{
		return true;
	}
}
function isEnglishWord(text){
	var newPar = /^[a-zA-Z]+$/;
	if(!newPar.test(text)){
		return false;
	}else{
		return true;
	}
}
function keyDownAction(method,ascCode){
	if(ascCode==13){
		eval(method);
		return false;
	}
	return true;
}
function showWaitDiv(state){
	if(state){
		document.body.scroll = "no";
		var width = document.body.clientWidth;
		var height = document.body.clientHeight;
		var myheigth = document.body.clientHeight;
		var showSetupIframe = document.getElementById("waitIframe");
		var showSetupDiv = document.getElementById("apdiv");
		showSetupIframe.style.display = "block";
		showSetupIframe.style.height = myheigth+"px";
		var left = width/2-200;
		var top = height/2-100;
		showSetupDiv.style.left = left+"px"; 
		showSetupDiv.style.top = top+"px";
		showSetupDiv.style.display = "block"
		if(document.all) {
			showSetupIframe.style.filter = "Alpha(Opacity=75)"; //for IE	.
		}else{
			showSetupIframe.style.opacity = 75/100; //for FF
		}
	}else{
		document.body.scroll = "yes";
		var showSetupIframe = document.getElementById("waitIframe");
		var showSetupDiv = document.getElementById("apdiv");
		showSetupDiv.style.display = "none"
		showSetupIframe.style.display = "none";
	}
}
function showCustomDiv(state,myDiv,myFrame,type){
	if(state){
		var width = $(document).width();
		var height = $(document).height();
		var myheigth = $(window).height();
		var showSetupIframe = $("#"+myFrame);
		var showSetupDiv = $("#"+myDiv);
		showSetupIframe.show();
		showSetupIframe.height(height);
		var left = (width-parseInt(showSetupDiv.width()))/2;
		var top = (myheigth-parseInt(showSetupDiv.height()))/2+$(window).scrollTop();
		showSetupDiv.css("top",top);
		showSetupDiv.css("left",left);
		showSetupDiv.show();
		showSetupIframe.animate({opacity:0.68},0);
	}else{
		var showSetupIframe = $("#"+myFrame);
		var showSetupDiv = $("#"+myDiv);
		if(type==1){
			showSetupDiv.hide();
			showSetupIframe.hide();
		}else{
			showSetupDiv.fadeOut("slow");
			showSetupIframe.fadeOut("slow");
		}
	}
}
function encodeText(text){
	if(text!=null&&text!=""){
		return encodeURIComponent(text);
	}else{
		return null;	
	}
}

function ckDigital(event)
  {
      //style="ime-mode:disabled" 禁用输入法
      //onparse="return false;"禁用粘贴
      //onkeyup="value=value.replace(/[^\d/.]/g,'')"  只输入数字
      var keycode = event.keyCode || event.charCode;     //火狐的是charCode
      if ((keycode<48 || keycode>57)) //判断是否为数字
      	  event.preventDefault();
          //event.returnValue=false;
          return false;
 }
 